/* Copyright (c) 2001 Nextel Communications, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *   - Neither the name of Nextel Communications, Inc. nor the names of its
 *     contributors may be used to endorse or promote products derived from
 *     this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NEXTEL
 * COMMUNICATIONS, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.nextel.ui.custom; // Generated package name

import com.nextel.ui.OComponent;
import com.nextel.util.StringUtils;
import com.nextel.util.lwuit.Font;
import javax.microedition.lcdui.Graphics;
import pe.com.nextel.util.ArrayList;
import pe.com.nextel.util.List;

/**
 * Provides a text label for display on the screen.  A label is not focusable,
 * meaning that it does not receive key press events.
 *
 * @author Glen Cordrey
 */
public class OStatusIndicator extends OComponent{

    private Font labelFont;
    private int height = 16;
    private int width = 300;
    private int colorSenal = 0x00ff0000;
    private int colorTiempo = 0x0000ff00;
    private int colorTexto = 0x00000000;
    private String textoSenal = "SE:";
    private String textoTiempo = "TI:";
    private final int anchoLed = 10,  altoLed = 10;
    private final int espacioLeds = 20;

    public OStatusIndicator(Font textFont) {
        labelFont = textFont;
    } // constructor
        
    /**
     * Paints the label to the screen.
     *
     * @param g The Graphics object to render to.
     */
    
    public void paint(Graphics g) {
        
        int x = getX();
        int y = getY();
        
        
        
        com.nextel.util.lwuit.Graphics graphics = new com.nextel.util.lwuit.Graphics(g);
        graphics.setFont(labelFont);
        
        //graphics.setColor(colorTexto);
        graphics.drawString(textoSenal, x, y);

        x += labelFont.stringWidth(textoSenal) + 2;

        g.setColor(colorSenal);
        g.fillArc(x, y + 3, anchoLed, altoLed, 0, 360);

        x += anchoLed + espacioLeds;

        //graphics.setColor(colorTexto);
        graphics.drawString(textoTiempo, x, y);

        x += labelFont.stringWidth(textoTiempo) + 2;

        g.setColor(colorTiempo);
        g.fillArc(x, y + 3, anchoLed, altoLed, 0, 360);
        
        
        // Logger.dev( "OLabel.paint EXITTING" );
    } // paint

    public int getColorSenal() {
        return colorSenal;
    }

    public void setColorSenal(int colorSenal) {
        this.colorSenal = colorSenal;
        repaint();
    }

    public int getColorTiempo() {
        return colorTiempo;
    }

    public void setColorTiempo(int colorTiempo) {
        this.colorTiempo = colorTiempo;
        repaint();
    }
    
     public int getHeight() {
//        if (Debug.ON) {
//            Logger.dev("OLabel.getHeight ENTERED");
//        }
        return height;
    } // getHeight

    /**
     * Gets the width of the label.  If the label contains multiple lines then the
     * width of the widest line is the width of the labe.
     *
     * @return an <code>int</code> value
     */
    public int getWidth() {
//        if (Debug.ON) {
//            Logger.dev("OLabel.getWidth ENTERED");
//        }
        return width;
    } // getWidth
}// OLabel

